package com.joker.repository;

import com.mysql.cj.xdevapi.JsonArray;
import net.sf.json.JSONObject;

import java.sql.*;
import java.util.ArrayList;

public class RootdelZw {
    String name=null;
    Connection connection= null;
    JsonArray array=new JsonArray();

    ResultSet resultSet=null;
    ArrayList<JSONObject> list=new ArrayList<>();
    public int show(String s1,String s2){
        //s1传的是展位的值
        //s2传的是用户的号
        try {
            Class.forName("com.mysql.jdbc.Driver");
            String url="jdbc:mysql://localhost:3306/huizhan?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC";
            String root="root";
            String password="123456";
            try {
                connection = DriverManager.getConnection(url,root,password);
            } catch (SQLException throwables) {
                throwables.printStackTrace();
            }
            String sql="delete from user_zhanwei where zwname = ? and username=? ";
            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1,s1);
            preparedStatement.setString(2,s2);


            int i=preparedStatement.executeUpdate();


        } catch (ClassNotFoundException | SQLException e) {
            e.printStackTrace();
        }finally {
            try {
                connection.close();
            } catch (SQLException throwables) {
                throwables.printStackTrace();
            }
        }
        return 0;
    }
}
